package com.lifp.controller;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Snowflake
 * @author lifp
 * @date 2023/04/25
 */
@Api(tags = "Snowflake")
@RestController
@RequestMapping("/snowflake")
public class SnowflakeController {

    @ApiOperation("生成编号")
    @GetMapping("generate")
    public Long test(){
        Snowflake snowflake = IdUtil.getSnowflake(1, 1);
        return snowflake.nextId();
    }
}
